//
//  FPVisualEffectView.m
//  FilmParadise
//
//  Created by lanou3g on 15/7/13.
//  Copyright (c) 2015年 DLYgroup. All rights reserved.
//

#import "FPVisualEffectView.h"

@implementation FPVisualEffectView

- (id)initWithImage:(UIImage *)image
{
    self = [super initWithImage:image];
    if (self) {
        self.visualEffectView = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
        self.visualEffectView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight / 3 * 2);
        self.visualEffectView.alpha = 0.8;
        
        self.userInteractionEnabled = YES;
     
        [self addSubview:_visualEffectView];
        
     }
    return self;
}

- (void)setImage:(UIImage *)image
{
    if (!_immmView) {
        _immmView = [[UIImageView alloc]init];
        _immmView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight / 3 * 2);
    }
    if (!_visualEffectView ) {
        _visualEffectView = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
        _visualEffectView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight / 3 * 2);
        _visualEffectView.alpha = 0.8;
    }
    
    _immmView.image = image;
    [_immmView addSubview:_visualEffectView];
    [self addSubview:_immmView];
}
@end
